﻿@using System.Data;
@{
   Layout = "~/Areas/admin/Views/Shared/_LayoutList.cshtml";
   ViewBag.Title = "模板文件管理";
   DataTable list = ViewData["list"] as DataTable;
}
@section HeaderContent{
   <script>
      //查询数据
      function search() {
         var text = $("#txtKeywords").val();
         var pageCount = $("#txtPageNum").val();
         document.location = "index?keywords=" + text + "&pagesize=" + pageCount;
      }

      //删除数据
      function __doPostBack() {
         var $row = $("#ltable tr:gt(0)");
         var json = { list: [] };
         $($row).each(function (i, item) {
            if ($(item).find("input:checkbox").prop("checked")) {
               var name = $(item).find("td:eq(0)").find("label:eq(0)").text();
               var obj = { name: name };
               json.list.push(obj);
            }
         });
         $.ajax({
            url: "SubmitDelete?skin=@ViewBag.SkinName",
            type: "POST",
            dataType: "html",
            data: "json=" + JSON.stringify(json),
            success: function (data) {
               eval(data);
            },
            error: function () {
               alert("error");
            }
         });
      }

      function selectChanged() {
         var text = $("#ddlSiteType").val();
         var $row = $("#ltable tr:gt(0)");
         var json = { list: [] };
         $($row).each(function (i, item) {
            if ($(item).find("input:checkbox").prop("checked")) {
               var name = $(item).find("td:eq(0)").find("label:eq(0)").text();
               var obj = { skinName: name };
               json.list.push(obj);
            }
         });
         document.location.href = "index?skin=@ViewBag.SkinName&siteType=" + text;
      }
   </script>
}
<form id="form1" method="post" action="SubmitSave">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="../../center/index"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>界面管理</span>
  <i class="arrow iconfont icon-arrow-right"></i>
  <a href="../templet_list/index"><span>模板管理</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>编辑模板：@ViewBag.skinName</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a href="javascript:;" onclick="checkAll(this);"><i class="iconfont icon-check"></i><span>全选</span></a></li>
          <li><a href="javascript:;" onclick="ExePostBack('btnDelete','此操作将会彻底删除文件，确定要继续吗？');"><i class="iconfont icon-delete"></i><span>删除</span></a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable" id="ltable">
    <tr>
      <th width="8%">选择</th>
      <th align="left">文件名称</th>
      <th align="left" width="20%">创建时间</th>
      <th align="left" width="20%">最后修改时间</th>
      <th width="10%">操作</th>
    </tr>
   @foreach(DataRow dr in list.Rows){
       <tr>
         <td align="center">
           <span class="checkall" style="vertical-align:middle">
              <input type="checkbox" />
           </span>
           <label style="display:none">@dr["name"]</label>
         </td>
         <td><a href="../templet_file_edit/index?path=@dr["skinname"]&filename=@dr["name"]">@dr["name"]</a></td>
         <td>@dr["creationtime"]</td>
         <td>@dr["updatetime"]</td>
         <td align="center"><a href="../templet_file_edit/index?path=@dr["skinname"]&filename=@dr["name"]">编辑</a></td>
       </tr>
   }
   @if (list.Rows.Count == 0) {
      <tr><td align="center" colspan="5">暂无文件</td></tr>
   }
  </table>
</div>
<!--/列表-->

</form>
